#ifndef GAMEWINDOW_H
#define GAMEWINDOW_H

#include <QMainWindow>
#include <QGroupBox>
#include <QPushButton>
#include <QFile>
#include <QJsonDocument>
#include <QJsonObject>
#include <QJsonArray>
#include <QInputDialog>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>

#include "game.h"
#include "level.h"
#include "snakehead.h"
#include "myrandom.h"

using std::vector;

QT_BEGIN_NAMESPACE
namespace Ui { class GameWindow; }
QT_END_NAMESPACE

class SnakeHead;

class GameWindow : public QMainWindow
{
    Q_OBJECT

public:
    GameWindow(QWidget *parent = nullptr);
    /*Load Static from progress.json*/
    bool LoadStatics();
    int LoadChapter();
    /*Show loading window and load statics*/
    bool ShowLoading();
    bool ShowProgressWindow();
    bool ShowUserBar();
    bool ShowMenuBar();
    bool ShowUserMainWindow();
    bool ShowSnakeHead();
    ~GameWindow();

private:
    Ui::GameWindow *ui;
    int Progress;
    int Progress2;
    int Terminal;
    int Terminal2;
    QString mUserName;
    int NowHead = 0;
    vector<SnakeHead> SnakeHeads;
    //QGroupBox LevelQGB(QWidget*);
    vector<Level*> Levels;

public slots:
    void HitStartButton();
    void SnakeHeadTurnLeft();
    void SnakeHeadTurnRight();
    void ShowLevels();
    void StartGame();
};

#endif // GAMEWINDOW_H
